/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.home.leva.db;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author leva
 */
public class DataBase {
    
    private static Connection conn;
    private static DataBase database=null;

    private DataBase() {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/szakdolgozat","Leva","getta");
        } catch (Exception ex) {
            Logger.getLogger(DataBase.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
    
    
    public static synchronized  DataBase getInstance(){
        if (database==null) database= new DataBase();
        
        return database;
    }
    
    
    public Connection getConnection(){
        return conn;
    }
    
}
